﻿<Page
    x:Name="pageRoot"
    x:Class="Animation.CharacterPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Animation"
    xmlns:common="using:Animation.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:bam="using:Brain.Animate"
    mc:Ignorable="d">

    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
            
                  
        </Grid>

        <Grid Grid.Row="1">

            <bam:AnimatedImage x:Name="Surge"
                HorizontalAlignment="Left" Margin="320,0" Grid.Row="0"
                Width="64" Height="64" 
                SpriteWidth="64" SpriteHeight="64" 
                SpriteSheetSource="/Images/surge.png" 
                FrameTimeSpan="00:00:00.2" 
                RenderTransformOrigin="0.5,0.5" >

                <!-- Images from Open Sonic project http://sourceforge.net/projects/opensnc/ -->

                <bam:AnimatedImage.SpriteCoordinates>
                    <bam:SpriteCoordinate Name="Ball1" X="-192" Y="-64" />
                    <bam:SpriteCoordinate Name="Ball2" X="-256" Y="-64" />
                    <bam:SpriteCoordinate Name="Ball3" X="-320" Y="-64" />
                    <bam:SpriteCoordinate Name="Ball4" X="-384" Y="-64" />

                    <bam:SpriteCoordinate Name="Sun1" X="-448" Y="-256" />
                    <bam:SpriteCoordinate Name="Sun2" X="0" Y="-320" />
                    <bam:SpriteCoordinate Name="Sun3" X="-64" Y="-320" />
                    <bam:SpriteCoordinate Name="Sun4" X="-128" Y="-320" />
                    <bam:SpriteCoordinate Name="Sun5" X="-192" Y="-320" />
                    <bam:SpriteCoordinate Name="Sun6" X="-256" Y="-320" />
                </bam:AnimatedImage.SpriteCoordinates>
            </bam:AnimatedImage>


        </Grid>
        
        <StackPanel Grid.Row="2">
            <Button Content="Animate" Click="Animate_Click" />
            <Button Content="AnimateSun" Click="AnimateSun_Click" />
        </StackPanel>

    </Grid>
</Page>
